#include <iostream>
#define SIZE 100

using namespace std;

int n, j = -1, k = -1, all[SIZE], nnule[SIZE], prime[SIZE], message[SIZE];

void read();
int check_prime(int );
void print();

int main()
{
	int i, ok = 0;
	read();
	
	for (i = 0; i < n; ++i)
	{	
		if (check_prime(all[i]) == 1)
		{
			++j;
			prime[j] = all[i];
			ok = 1;
		}
		if (all[i] != 0)
		{
			++k;
			nnule[k] = all[i];
			ok = 1;
		}
		if (ok == 0)
		{
			cout << "The element" << all[i] << "doesn`t have any property";
		}
	}
	
	print();
	
	return 0;
}

void read()
{
	int i;
	cout << "n = ";
	cin >> n;
	for (i = 0; i < n; ++i)
	{	cout << "all[" << i << "]= ";
		cin >> all[i];
	}
}

int check_prime(int x)
{
	int i;
	int ok = 1;
	
	for (i = 2; i <= x / 2; ++i)
		if (x % i == 0)
			ok = 0;
	return ok;
}

void print()
{
	int i;
	for (i = 0; i < n; ++i)
		cout << all[i];
		cout << endl;
	for (i = 0; i < j; ++i)
		cout << prime[i];
		cout << endl;
	for (i = 0; i <= k; ++i)
		cout << nnule[i];
		cout << endl;
}